﻿using Sundry.IDAL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Sundry.DAL
{
    //一次跟数据库交互的会话
    public class DbSession : IDbSession
    {
        /// <summary>
        /// 统一SaveChange方法
        /// </summary>
        /// <returns></returns>
        public int SaveChange()
        {
            return DbContextFactory.GetCurrentDbConText().SaveChanges();
        }
        /// <summary>
        /// 获取管理员登录日志仓储
        /// </summary>
        public IDAL.IAdminLoginLogRepository AdminLoginLogRepository { get { return new AdminLoginLogRepository(); } }
        /// <summary>
        /// 获取管理员仓储
        /// </summary>
        public IDAL.IAdminRepository AdminRepository { get { return new AdminRepository(); } }
        /// <summary>
        /// 获取操作日志仓储
        /// </summary>
        public IDAL.IAdminOperationRepository AdminOperationRepository { get { return new AdminOperationRepository(); } }
        /// <summary>
        /// 获取权限仓储
        /// </summary>
        public IDAL.IAuthoryRepository AuthoryRepository { get { return new AuthoryRepository(); } }
        /// <summary>
        /// 获取操作目录仓储
        /// </summary>
        public IDAL.IAdminMenuRepository AdminMenuRepository { get { return new AdminMenuRepository(); } }
        /// <summary>
        /// 获取品牌仓储
        /// </summary>
        public IDAL.IBrandRepository BrandRepository { get { return new BrandRepository(); } }
        /// <summary>
        /// 获取分类仓储
        /// </summary>
        public IDAL.ICategoryRepository CategoryRepository { get { return new CategoryRepository(); } }
    }
}
